set more off
clear

do set_path.do

***** Fig 1: Benchmark CIP during transition *****

use "${datadir}cip_all_both.dta", clear

gen ibor_cip_rf=(ibor_r-ibor_r_usd-ibor_rho)*100
gen sofr_cip_rf=(sofr_r-sofr_r_usd-sofr_rho)*100

keep if date>=mdy(1,1,2017) & date<=mdy(6,30,2025)

local currs CAD CHF EUR GBP JPY
foreach curr of local currs {
	twoway (tsline ibor_cip_rf sofr_cip_rf if currency=="`curr'" & tenor=="3m", cmissing(yes) lwidth(vthin vthin) lcolor(blue red)), ///
	yline(0, lstyle(solid)) ylabel(,labsize(small) nogrid) xlabel(,labsize(small) format(%tdCY) nogrid) xtitle("") ytitle("Basis Points") legend(pos(6) rows(1) size(medium) label(1 "IBOR") label(2 "Alternative Benchmark") )  ///
	subtitle(, size(small) ring(0) pos(1) nobexpand) ///
	note("") legend(pos(6) rows(1) size(small)) name("`curr'_3m", replace) title("`curr'", size(medium))
}

grc1leg CAD_3m CHF_3m EUR_3m GBP_3m JPY_3m
graph export "${outdir}figures/3m_combined.pdf", replace

graph close _all
